<template>
  <div>
count:{{ count }}
<button @click="count++">+</button>
  </div>
</template>

<script setup>
import { ref,watch  } from 'vue'

const count=ref(0)
watch(count,(newV,oldV)=>{
  console.log('count变化了',newV,oldV);
},{
  immediate:true
})
</script>

<style lang="scss" scoped>

</style>